package com.wenhao.inputoutput;

import java.util.Scanner;

/**
 * @author Wenhao Tong
 * @create 2021-07-21 16:56
 */
public class Main4 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int n = scanner.nextInt();
            if (n == 0) {
                break;
            }
            int sum = 0;
            for (int i = 0;i < n;i++) {
                sum += scanner.nextInt();
            }
            System.out.println(sum);
        }
    }
}
